using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;

namespace Musicman.Entities.BusinessEntities
{
    public class SearchResult
    {
        private long fileID;
        private string name;
        private string fullpath;
        private string location;
        private long length;
        private float mbLength = 0;
        private CultureInfo MyCi = new CultureInfo("en-US");

        public long FileID
        {
            get { return fileID; }
            set { fileID = value; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string NameTrimmed
        {
            get 
            {
                if (this.name.Length > 50)
                {
                    return name.Substring(0, 47) + "...";
                }
                else
                {
                    return name;
                }
            }
        }

        public string Fullpath
        {
            get { return fullpath; }
            set { fullpath = value; }
        }

        public string Location
        {
            get { return location; }
            set { location = value; }
        }

        public long Length
        {
            get { return length; }
            set 
            { 
                length = value;
                mbLength = (float)this.length / 1048576;
            }
        }

        public string TotalLengthMB
        {
            get
            {
                return String.Format("{0} MB", this.mbLength.ToString("0.00", MyCi.NumberFormat));
            }
        }
    }
}
